package com.zygh.policeasset.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zygh.policeasset.component.CommonResult;
import com.zygh.policeasset.mapper.VisualSettingsMapper;
import com.zygh.policeasset.pojo.VisualSettings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/service/VisualSettingsService.class */
public class VisualSettingsService {
    @Autowired
    VisualSettingsMapper visualSettingsMapper;

    public VisualSettings queryById(Integer id) {
        return this.visualSettingsMapper.queryById(id);
    }

    public PageInfo queryAll(int pageNum, int pageSize, VisualSettings visualSettings) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo(this.visualSettingsMapper.queryAll(visualSettings));
    }

    public CommonResult insert(VisualSettings visualSettings) {
        if (this.visualSettingsMapper.insert(visualSettings) > 0) {
            return new CommonResult().success();
        }
        return new CommonResult().validateFailed("添加失败");
    }

    public CommonResult update(VisualSettings visualSettings) {
        if (this.visualSettingsMapper.update(visualSettings) > 0) {
            return new CommonResult().success();
        }
        return new CommonResult().validateFailed("修改失败");
    }

    public CommonResult deleteById(Integer id) {
        if (this.visualSettingsMapper.deleteById(id) > 0) {
            return new CommonResult().success();
        }
        return new CommonResult().validateFailed("删除失败");
    }
}